﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using PowerCreator.LMS.Question.Core;
using PowerCreator.LMS.Question.Entiry;
using System.Text;
using PowerCreator.LMS.Common.Script;

public partial class sysadmin_QuestionManager_OpenQuestionResource : System.Web.UI.Page
{
    //ManagerQuestionResourceInfo objManagerQuestionResourceInfo = new ManagerQuestionResourceInfo();
    ManagerQuestion objQuestion = new ManagerQuestion();
    protected string videoUrl = string.Empty;
    protected void Page_Load(object sender, EventArgs e)
    {
        string ID = Request.QueryString["ID"].ToString();

         OpenResource(ID);
         //InitPage();
    }
    //protected override void InitPage()
    //{
    //    base.InitPage();
    //}
    private void OpenResource(string  ID)
    {
        DataTable dt_resource = new DataTable();
        dt_resource = objQuestion.QueryQuestionResource(" QuestionResGuID='" + ID + "'");

        if (dt_resource.Rows.Count > 0)
        {
            VOQuestionResource objQuestionResourceInfo = new VOQuestionResource();
            objQuestionResourceInfo = objQuestion.LoadQuestionResource(int.Parse(dt_resource.Rows[0]["QuestionResID"].ToString()));
            if (objQuestionResourceInfo.QuestionResFileType == 1)
            {
                videoUrl = objQuestionResourceInfo.QuestionResUrl;
            }
            else
            {
                Script.RedirectURL(objQuestionResourceInfo.QuestionResUrl);
                Response.End();
                Script.CloseMe();
            }
        }
        else
        {
            Script.Alert(this,"msg","资源不存在");
        }
        
       
 
    }
}
